//
//  SCRadioListCollectionViewCell.m
//  OurMoon
//
//  Created by dllo on 15/11/3.
//  Copyright © 2015年 sc. All rights reserved.
//

#import "SCRadioListCollectionViewCell.h"
#import "NightHeader.h"
#import <UIImageView+WebCache.h>
#import "FitHeader.h"
@implementation SCRadioListCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createViews];
    }
    return self;
}
- (void)createViews
{
    _bigImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:_bigImageView];
    
    _titleLabel = [[UILabel alloc] init];
    _titleLabel.textAlignment = 1;
    _titleLabel.font = [UIFont systemFontOfSize:13 * FitWidth];
    [self.contentView addSubview:_titleLabel];
    
    _tnameLabel = [[UILabel alloc] init];
    _tnameLabel.font = [UIFont systemFontOfSize:12 * FitWidth];
    _tnameLabel.numberOfLines = 0;
    [self.contentView addSubview:_tnameLabel];
}

- (void)setRadioModel:(SCRadioModel *)radioModel
{
    _radioModel = radioModel;
    [_bigImageView sd_setImageWithURL:[NSURL URLWithString:radioModel.imgsrc] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    _titleLabel.text = radioModel.tname;
    _tnameLabel.text = radioModel.title;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    _bigImageView.frame = CGRectMake(10 * FitWidth, 5 * FitHeight, 90 * FitWidth, 90 * FitWidth);
    _bigImageView.layer.cornerRadius = 45 * FitWidth;
    _bigImageView.layer.masksToBounds = YES;
    _titleLabel.frame = CGRectMake(_bigImageView.frame.origin.x, _bigImageView.frame.origin.y + _bigImageView.frame.size.height, _bigImageView.frame.size.width, 20 * FitHeight);
    _tnameLabel.frame = CGRectMake(_titleLabel.frame.origin.x - 5 * FitWidth, _titleLabel.frame.origin.y + _titleLabel.frame.size.height, _titleLabel.frame.size.width + 5 * FitWidth, 50 * FitHeight);
}

@end
